package com.digitalchina.cfs.ta.patientDataArea.action;

import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.log4j.Logger;

import com.digitalchina.cfs.ta.cost.action.CostAnalyzeAction;
import com.digitalchina.cfs.ta.patientDataArea.service.PatientNumService;
import com.digitalchina.frame.action.BaseAction;
import com.digitalchina.frame.util.HttpRequestUtil;
import com.google.gson.Gson;

public class PatientNumAction extends BaseAction{

	private static final long serialVersionUID = 1L;
	private static Logger logger=Logger.getLogger(CostAnalyzeAction.class);
	private PatientNumService patientNumService;

	public PatientNumService getPatientNumService() {
		return patientNumService;
	}

	public void setPatientNumService(PatientNumService patientNumService) {
		this.patientNumService = patientNumService;
	}
	
	public String qryAllNumHospital()throws Exception{
		return "sta";
	} 
	
	public void qryAllNum() throws Exception{
		Map<String, String> para=HttpRequestUtil.getParameter(this.servletRequest);
		List list = patientNumService.getAllNum(para);
//		System.out.println("+++++++++++"+para);
		
//		System.out.println("3322"+list);
		this.servletResponse.setContentType("text/json;charset=GBK");
		PrintWriter out = this.servletResponse.getWriter();
		Gson gson = new Gson();
		out.print(gson.toJson(list));
		out.flush();
		out.close();
	}
	
	public void qryAllHosNum() throws Exception{
		Map<String, String> para=HttpRequestUtil.getParameter(this.servletRequest);
		List list = patientNumService.getAllHosNum(para);
		
		this.servletResponse.setContentType("text/json;charset=GBK");
		PrintWriter out = this.servletResponse.getWriter();
		Gson gson = new Gson();
		out.print(gson.toJson(list));
		out.flush();
		out.close();
	}
	
	public void qryAllJobNum() throws Exception{
		Map<String, String> para=HttpRequestUtil.getParameter(this.servletRequest);
		List list = patientNumService.getAllJobNum(para);
		this.servletResponse.setContentType("text/json;charset=GBK");
		PrintWriter out = this.servletResponse.getWriter();
		Gson gson = new Gson();
		out.print(gson.toJson(list));
		out.flush();
		out.close();
		
	}
	
	public void qryIncidenceRateAge() throws Exception{
		Map<String, String> para=HttpRequestUtil.getParameter(this.servletRequest);
		List list = patientNumService.getIncidenceRateAge(para);
		this.servletResponse.setContentType("text/json;charset=GBK");
		PrintWriter out = this.servletResponse.getWriter();
		Gson gson = new Gson();
		out.print(gson.toJson(list));
		out.flush();
		out.close();
		
	}
	
	public void qryIncidenceRateSex() throws Exception{
		Map<String, String> para=HttpRequestUtil.getParameter(this.servletRequest);
		List list = patientNumService.getIncidenceRateSex(para);
		this.servletResponse.setContentType("text/json;charset=GBK");
		PrintWriter out = this.servletResponse.getWriter();
		Gson gson = new Gson();
		out.print(gson.toJson(list));
		out.flush();
		out.close();
		
	}
}
